﻿ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using ClassLibrary;

namespace ClassLibrary
{
    public class GlobalData 
    {
        private static Core _core;
        public static Core Core_
        {
            get 
            {
                if (GlobalData._core == null)
                    GlobalData._core = new Core();
                return GlobalData._core;
            }
        }
        public static void SaveCore(string filename)
        {
            if (_core != null && Core_ is ClassLibrary.Core)
            {
                FileStream outStream = new FileStream(filename, FileMode.Create);
                (_core as ClassLibrary.Core).SaveCore(outStream);
                outStream.Close();
            }
        }
        public static void LoadCore(Stream inStream)
        {
            GlobalData._core = Core.LoadCore(inStream);
        }
    }
}
